/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1622394756182_3791';

  // 中间件的配置
  config.middleware = ['testJwt'];
  config.testJwt = {
    enable:true, // 开启中间件
    ignore:'/admin/login', // 只忽略指定路由,
  }

  // cors跨域资源共享
  config.cors = {
    origin:'*',
    allowMethods:'GET,HEAD,OPTIONS,PUT,POST,DELETE,PATCH',
  };

  // 关闭csrf安全
  config.security = {
    csrf:{
      enable:false
    }
  }

  // 数据库配置

  config.sequelize = {
    dialect: 'mysql', // 数据库类型
    host: '127.0.0.1',
    port: 3306,
    database: 'shop', // 数据库名
    username:'root',
    password:'12345678',
    define: {
      underscored: false, // 禁止把下划线做间隔的表明转变成驼峰
      freezeTableName: true, // 冻结表名 意思是 sequelize会自动把表名添加负数，所以需要冻结避免被修改
      timestamps: false,
    },

  }

  config.jwt = {
    secret: '123456',	//自定义token的加密条件字符串，可按各自的需求填写
  }


  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };



  return {
    ...config,
    ...userConfig,
  };
};
